package gxb.test07;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Scanner;

public class Deli {
    public static void main(String[] args) {
        final double OUNCE_PER_POUND = 16.0;
        DecimalFormat fmt = new DecimalFormat("#.##"); // 添加DecimalFormat对象
        NumberFormat money = NumberFormat.getCurrencyInstance(); // 添加NumberFormat对象
        double pricePerPound,weightOunces,weight,totalPrice;
        Scanner scan = new Scanner(System.in);
        System.out.println("Welcome to the CS Deli!!\n");
        System.out.println("Enter the price per pound of your item");
        pricePerPound = scan.nextDouble();
        System.out.println("Enter the Weight(ounces):");
        weightOunces = scan.nextDouble();
        weight= weightOunces / OUNCE_PER_POUND;
        totalPrice = pricePerPound *weight;
        String money1 = money.format(totalPrice);
        String money2 = money.format(pricePerPound);
        String weight1 = fmt.format(weight);
        System.out.println("打印price和total price:"+money1+"____"+"totalPrice:"+money2);
        System.out.println("fmt打印weight:"+weight1);

    }
}
